<?php
/**
 * Created by PhpStorm.
 * User: 独行侠
 * Date: 2018/2/7
 * Time: 16:25
 */

namespace App\Services\Address;


use App\Repositories\Address\DeliverRegionOrderPeakRepository;

class DeliverRegionOrderPeakService
{
    /**
     * @var DeliverRegionOrderPeakRepository
     */
    protected $deliverRegionOrderPeakRepository;

    /**
     * DeliverRegionOrderPeakService constructor.
     * @param DeliverRegionOrderPeakRepository $deliverRegionOrderPeakRepository
     */
    public function __construct(DeliverRegionOrderPeakRepository $deliverRegionOrderPeakRepository)
    {
        $this->deliverRegionOrderPeakRepository = $deliverRegionOrderPeakRepository;
    }

    /**
     * 处理区域订单峰值信息
     * @author Min
     * @param $wdr_id 区域id
     * @return array
     */
    public function getOrderPeakByWdrId($wdr_id)
    {
        $data = $this->deliverRegionOrderPeakRepository->getOrderPeakByWdrId($wdr_id);

        $order_peak = [];

        foreach ($data as $key=>$val) {
            $order_peak[$val['time_id']] = array(
                'order_peak' => $val['order_peak'],
                'is_free_single' => $val['is_free_single'],
            );
        }

        return $order_peak;
    }

}